home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 2620 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.7 KB

  1. Path: comma.rhein.de!yaps!arno
  2. From: arno@yaps.rhein.de (Arno Eigenwillig)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: C compiler problem
  5. Message-ID: <JAx1y*HHf@yaps.rhein.de>
  6. Date: Fri, 02 Feb 1996 18:30:05 +0100
  7. References: <4ek3b2$a5k@nntp.novia.net> <3005pbd60.alamito@marketgraph.xs4all.nl>
  8. Organization: Yet Another Private Site in Meckenheim, Germany
  9. X-Copyright: This article may not be distributed on a CD-ROM
  10.  or in printed form without prior written consent of the author.
  11. X-Newsreader: Arn V 1.04
  12.  
  13. In article <3005pbd60.alamito@marketgraph.xs4all.nl>, Ruud van Gaal writes:
  14.  
  15. > >int main();
  16. > Can be left out.
  17.  
  18. Yes.
  19.  
  20. > >int main()
  21. > void main(void) is better prototyped in C. C++ might use void main()
  22.  
  23. Doubly wrong!
  24.  
  25. - This is a function definition, not a prototype. If you declare no
  26.   parameters in a function definition (just use "()"), the function
  27.   takes none. This is not to be confused with a prototype context,
  28.   in which an empty parameter list means that nothing is said about
  29.   which parameters the function takes.
  30.   The meaning of a parameter list consisting of "void" is equivalent
  31.   for both cases.
  32.  
  33. - By ISO 9899, The ANSI/ISO C Standard, the only two permissible forms
  34.   for main() for a strictly conforming program are:
  35.       int main(void)
  36.       int main(int, char**)
  37.   Everything else results in undefined behaviour, which is in this
  38.   case relatively benign under AmigaOS: usually a nonsentical return
  39.   code. This is rather annoying, though, if the program is invoked
  40.   from a shell.
  41.  
  42. C++ is different.
  43.  
  44. -- __
  45. __/// Arno Eigenwillig /\ <arno@yaps.rhein.de> \/ PGP key available.
  46. \XX/   V+49-2225-5870  /\ <Arnooo @ #amigager> \/ MIME 8bit welcome.
  47.